<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Object</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Object</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../files/vendor/rails/railties/lib/rails_generator/lookup_rb.html">
                vendor/rails/railties/lib/rails_generator/lookup.rb
                </a>
        <br />
                <a href="../files/vendor/rails/actionpack/lib/action_controller/routing/routing_ext_rb.html">
                vendor/rails/actionpack/lib/action_controller/routing/routing_ext.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/blank_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/blank.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/duplicable_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/duplicable.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/kernel/agnostics_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/kernel/agnostics.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/object/conversions_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/object/conversions.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/object/extending_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/object/extending.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/object/instance_variables_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/object/instance_variables.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/object/metaclass_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/object/metaclass.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/core_ext/object/misc_rb.html">
                vendor/rails/activesupport/lib/active_support/core_ext/object/misc.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/json/encoders/object_rb.html">
                vendor/rails/activesupport/lib/active_support/json/encoders/object.rb
                </a>
        <br />
                <a href="../files/vendor/rails/activesupport/lib/active_support/vendor/builder-2_1_2/blankslate_rb.html">
                vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Object.html">
                Object
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
Same as above, except in <a href="Object.html">Object</a>.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000036">acts_like?</a>&nbsp;&nbsp;
      <a href="#M000024">blank?</a>&nbsp;&nbsp;
      <a href="#M000033">class_eval</a>&nbsp;&nbsp;
      <a href="#M000026">duplicable?</a>&nbsp;&nbsp;
      <a href="#M000039">find_hidden_method</a>&nbsp;&nbsp;
      <a href="#M000029">instance_exec</a>&nbsp;&nbsp;
      <a href="#M000030">instance_variable_defined?</a>&nbsp;&nbsp;
      <a href="#M000031">instance_variable_names</a>&nbsp;&nbsp;
      <a href="#M000022">lookup_missing_generator</a>&nbsp;&nbsp;
      <a href="#M000032">metaclass</a>&nbsp;&nbsp;
      <a href="#M000038">method_added</a>&nbsp;&nbsp;
      <a href="#M000025">present?</a>&nbsp;&nbsp;
      <a href="#M000034">returning</a>&nbsp;&nbsp;
      <a href="#M000037">to_json</a>&nbsp;&nbsp;
      <a href="#M000023">to_param</a>&nbsp;&nbsp;
      <a href="#M000027">to_param</a>&nbsp;&nbsp;
      <a href="#M000028">to_query</a>&nbsp;&nbsp;
      <a href="#M000035">with_options</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->
    <div id="includes">
      <h3 class="section-bar">Included Modules</h3>

      <div id="includes-list">
        <span class="include-name">InstanceExecMethods</span>
      </div>
    </div>

    <div id="section">



    <div id="aliases-list">
      <h3 class="section-bar">External Aliases</h3>

      <div class="name-list">
                        <table summary="aliases">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">method_added</td>
          <td>-&gt;</td>
          <td class="context-item-value">blank_slate_method_added</td>
        </tr>
                        </table>
      </div>
    </div>


      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000039" class="method-detail">
        <a name="M000039"></a>

        <div class="method-heading">
          <a href="#M000039" class="method-signature">
          <span class="method-name">find_hidden_method</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000039-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000039-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb, line 90</span>
90:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">find_hidden_method</span>(<span class="ruby-identifier">name</span>)
91:       <span class="ruby-keyword kw">nil</span>
92:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000022" class="method-detail">
        <a name="M000022"></a>

        <div class="method-heading">
          <a href="#M000022" class="method-signature">
          <span class="method-name">lookup_missing_generator</span><span class="method-args">(class_id)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Lookup missing generators using const_missing. This allows any generator to
reference another without having to know its location: RubyGems,
~/.rails/generators, and RAILS_ROOT/generators.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000022-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000022-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/railties/lib/rails_generator/lookup.rb, line 10</span>
10:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">lookup_missing_generator</span>(<span class="ruby-identifier">class_id</span>)
11:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">md</span> = <span class="ruby-regexp re">/(.+)Generator$/</span>.<span class="ruby-identifier">match</span>(<span class="ruby-identifier">class_id</span>.<span class="ruby-identifier">to_s</span>)
12:         <span class="ruby-identifier">name</span> = <span class="ruby-identifier">md</span>.<span class="ruby-identifier">captures</span>.<span class="ruby-identifier">first</span>.<span class="ruby-identifier">demodulize</span>.<span class="ruby-identifier">underscore</span>
13:         <span class="ruby-constant">Rails</span><span class="ruby-operator">::</span><span class="ruby-constant">Generator</span><span class="ruby-operator">::</span><span class="ruby-constant">Base</span>.<span class="ruby-identifier">lookup</span>(<span class="ruby-identifier">name</span>).<span class="ruby-identifier">klass</span>
14:       <span class="ruby-keyword kw">else</span>
15:         <span class="ruby-identifier">const_missing_before_generators</span>(<span class="ruby-identifier">class_id</span>)
16:       <span class="ruby-keyword kw">end</span>
17:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000038" class="method-detail">
        <a name="M000038"></a>

        <div class="method-heading">
          <a href="#M000038" class="method-signature">
          <span class="method-name">method_added</span><span class="method-args">(name)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Detect method additions to <a href="Object.html">Object</a> and remove them
in the <a href="BlankSlate.html">BlankSlate</a> class.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000038-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000038-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/vendor/builder-2.1.2/blankslate.rb, line 83</span>
83:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">method_added</span>(<span class="ruby-identifier">name</span>)
84:       <span class="ruby-identifier">result</span> = <span class="ruby-identifier">blank_slate_method_added</span>(<span class="ruby-identifier">name</span>)
85:       <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">result</span> <span class="ruby-keyword kw">if</span> <span class="ruby-keyword kw">self</span> <span class="ruby-operator">!=</span> <span class="ruby-constant">Object</span>
86:       <span class="ruby-constant">BlankSlate</span>.<span class="ruby-identifier">hide</span>(<span class="ruby-identifier">name</span>)
87:       <span class="ruby-identifier">result</span>
88:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000036" class="method-detail">
        <a name="M000036"></a>

        <div class="method-heading">
          <a href="#M000036" class="method-signature">
          <span class="method-name">acts_like?</span><span class="method-args">(duck)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
A duck-type assistant method. For example, Active Support extends Date to
define an acts_like_date? method, and extends Time to define
acts_like_time?. As a result, we can do &quot;x.acts_like?(:time)&quot; and
&quot;x.acts_like?(:date)&quot; to do duck-type-safe comparisons, since
classes that we want to act like Time simply need to define an
acts_like_time? method.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000036-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000036-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/object/misc.rb, line 71</span>
71:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">acts_like?</span>(<span class="ruby-identifier">duck</span>)
72:     <span class="ruby-identifier">respond_to?</span> <span class="ruby-node">&quot;acts_like_#{duck}?&quot;</span>
73:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000024" class="method-detail">
        <a name="M000024"></a>

        <div class="method-heading">
          <a href="#M000024" class="method-signature">
          <span class="method-name">blank?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
An object is blank if it&#8216;s false, empty, or a whitespace string. For
example, &quot;&quot;, &quot; &quot;, <tt>nil</tt>, [], and {} are blank.
</p>
<p>
This simplifies
</p>
<pre>
  if !address.nil? &amp;&amp; !address.empty?
</pre>
<p>
to
</p>
<pre>
  if !address.blank?
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000024-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000024-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/blank.rb, line 12</span>
12:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">blank?</span>
13:     <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:empty?</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">empty?</span> <span class="ruby-operator">:</span> <span class="ruby-operator">!</span><span class="ruby-keyword kw">self</span>
14:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000033" class="method-detail">
        <a name="M000033"></a>

        <div class="method-heading">
          <a href="#M000033" class="method-signature">
          <span class="method-name">class_eval</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
If <a href="Object.html#M000033">class_eval</a> is called on an object, add
those methods to its <a href="Object.html#M000032">metaclass</a>
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000033-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000033-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/object/metaclass.rb, line 10</span>
10:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">class_eval</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
11:     <span class="ruby-identifier">metaclass</span>.<span class="ruby-identifier">class_eval</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
12:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000026" class="method-detail">
        <a name="M000026"></a>

        <div class="method-heading">
          <a href="#M000026" class="method-signature">
          <span class="method-name">duplicable?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Can you safely .dup this object? False for nil, false, true, symbols, and
numbers; true otherwise.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000026-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000026-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/duplicable.rb, line 4</span>
4:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">duplicable?</span>
5:     <span class="ruby-keyword kw">true</span>
6:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000029" class="method-detail">
        <a name="M000029"></a>

        <div class="method-heading">
          <a href="#M000029" class="method-signature">
          <span class="method-name">instance_exec</span><span class="method-args">(*args, &amp;block)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Evaluate the block with the given arguments within the context of this
object, so self is set to the method receiver.
</p>
<p>
From Mauricio&#8216;s <a
href="http://eigenclass.org/hiki/bounded+space+instance_exec">eigenclass.org/hiki/bounded+space+instance_exec</a>
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000029-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000029-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/object/extending.rb, line 63</span>
63:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instance_exec</span>(<span class="ruby-operator">*</span><span class="ruby-identifier">args</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>)
64:       <span class="ruby-keyword kw">begin</span>
65:         <span class="ruby-identifier">old_critical</span>, <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">critical</span> = <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">critical</span>, <span class="ruby-keyword kw">true</span>
66:         <span class="ruby-identifier">n</span> = <span class="ruby-value">0</span>
67:         <span class="ruby-identifier">n</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">while</span> <span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">method_name</span> = <span class="ruby-node">&quot;__instance_exec#{n}&quot;</span>)
68:         <span class="ruby-constant">InstanceExecMethods</span>.<span class="ruby-identifier">module_eval</span> { <span class="ruby-identifier">define_method</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">block</span>) }
69:       <span class="ruby-keyword kw">ensure</span>
70:         <span class="ruby-constant">Thread</span>.<span class="ruby-identifier">critical</span> = <span class="ruby-identifier">old_critical</span>
71:       <span class="ruby-keyword kw">end</span>
72: 
73:       <span class="ruby-keyword kw">begin</span>
74:         <span class="ruby-identifier">send</span>(<span class="ruby-identifier">method_name</span>, <span class="ruby-operator">*</span><span class="ruby-identifier">args</span>)
75:       <span class="ruby-keyword kw">ensure</span>
76:         <span class="ruby-constant">InstanceExecMethods</span>.<span class="ruby-identifier">module_eval</span> { <span class="ruby-identifier">remove_method</span>(<span class="ruby-identifier">method_name</span>) } <span class="ruby-keyword kw">rescue</span> <span class="ruby-keyword kw">nil</span>
77:       <span class="ruby-keyword kw">end</span>
78:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000030" class="method-detail">
        <a name="M000030"></a>

        <div class="method-heading">
          <a href="#M000030" class="method-signature">
          <span class="method-name">instance_variable_defined?</span><span class="method-args">(variable)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000030-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000030-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/object/instance_variables.rb, line 4</span>
4:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instance_variable_defined?</span>(<span class="ruby-identifier">variable</span>)
5:       <span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">include?</span>(<span class="ruby-identifier">variable</span>.<span class="ruby-identifier">to_s</span>)
6:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000031" class="method-detail">
        <a name="M000031"></a>

        <div class="method-heading">
          <a href="#M000031" class="method-signature">
          <span class="method-name">instance_variable_names</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000031-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000031-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/object/instance_variables.rb, line 37</span>
37:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instance_variable_names</span>
38:       <span class="ruby-identifier">instance_variables</span>.<span class="ruby-identifier">map</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">var</span><span class="ruby-operator">|</span> <span class="ruby-identifier">var</span>.<span class="ruby-identifier">to_s</span> }
39:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000032" class="method-detail">
        <a name="M000032"></a>

        <div class="method-heading">
          <a href="#M000032" class="method-signature">
          <span class="method-name">metaclass</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Get object&#8216;s meta (ghost, eigenclass, singleton) class
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000032-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000032-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/object/metaclass.rb, line 3</span>
3:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">metaclass</span>
4:     <span class="ruby-keyword kw">class</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-keyword kw">self</span>
5:       <span class="ruby-keyword kw">self</span>
6:     <span class="ruby-keyword kw">end</span>
7:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000025" class="method-detail">
        <a name="M000025"></a>

        <div class="method-heading">
          <a href="#M000025" class="method-signature">
          <span class="method-name">present?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
An object is present if it&#8216;s not blank.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000025-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000025-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/blank.rb, line 17</span>
17:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">present?</span>
18:     <span class="ruby-operator">!</span><span class="ruby-identifier">blank?</span>
19:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000034" class="method-detail">
        <a name="M000034"></a>

        <div class="method-heading">
          <a href="#M000034" class="method-signature">
          <span class="method-name">returning</span><span class="method-args">(value) {|value| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Returns <tt>value</tt> after yielding <tt>value</tt> to the block. This
simplifies the process of constructing an object, performing work on the
object, and then <a href="Object.html#M000034">returning</a> the object
from a method. It is a Ruby-ized realization of the K combinator, courtesy
of Mikael Brockman.
</p>
<h4>Examples</h4>
<pre>
 # Without returning
 def foo
   values = []
   values &lt;&lt; &quot;bar&quot;
   values &lt;&lt; &quot;baz&quot;
   return values
 end

 foo # =&gt; ['bar', 'baz']

 # returning with a local variable
 def foo
   returning values = [] do
     values &lt;&lt; 'bar'
     values &lt;&lt; 'baz'
   end
 end

 foo # =&gt; ['bar', 'baz']

 # returning with a block argument
 def foo
   returning [] do |values|
     values &lt;&lt; 'bar'
     values &lt;&lt; 'baz'
   end
 end

 foo # =&gt; ['bar', 'baz']
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000034-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000034-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/object/misc.rb, line 38</span>
38:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">returning</span>(<span class="ruby-identifier">value</span>)
39:     <span class="ruby-keyword kw">yield</span>(<span class="ruby-identifier">value</span>)
40:     <span class="ruby-identifier">value</span>
41:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000037" class="method-detail">
        <a name="M000037"></a>

        <div class="method-heading">
          <a href="#M000037" class="method-signature">
          <span class="method-name">to_json</span><span class="method-args">(options = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Dumps object in JSON (JavaScript <a href="Object.html">Object</a>
Notation). See <a href="http://www.json.org">www.json.org</a> for more
info.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000037-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000037-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/json/encoders/object.rb, line 3</span>
3:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_json</span>(<span class="ruby-identifier">options</span> = {})
4:     <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">JSON</span>.<span class="ruby-identifier">encode</span>(<span class="ruby-identifier">instance_values</span>, <span class="ruby-identifier">options</span>)
5:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000023" class="method-detail">
        <a name="M000023"></a>

        <div class="method-heading">
          <a href="#M000023" class="method-signature">
          <span class="method-name">to_param</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000023-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000023-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/rails/actionpack/lib/action_controller/routing/routing_ext.rb, line 2</span>
2:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_param</span>
3:     <span class="ruby-identifier">to_s</span>
4:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000027" class="method-detail">
        <a name="M000027"></a>

        <div class="method-heading">
          <a href="#M000027" class="method-signature">
          <span class="method-name">to_param</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Alias of <tt>to_s</tt>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000027-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000027-source">
<pre>
   <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/object/conversions.rb, line 3</span>
3:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_param</span>
4:     <span class="ruby-identifier">to_s</span>
5:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000028" class="method-detail">
        <a name="M000028"></a>

        <div class="method-heading">
          <a href="#M000028" class="method-signature">
          <span class="method-name">to_query</span><span class="method-args">(key)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Converts an object into a string suitable for use as a URL query string,
using the given <tt>key</tt> as the param name.
</p>
<p>
Note: This method is defined as a default implementation for all Objects
for Hash#to_query to work.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000028-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000028-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/object/conversions.rb, line 11</span>
11:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">to_query</span>(<span class="ruby-identifier">key</span>)
12:     <span class="ruby-node">&quot;#{CGI.escape(key.to_s)}=#{CGI.escape(to_param.to_s)}&quot;</span>
13:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000035" class="method-detail">
        <a name="M000035"></a>

        <div class="method-heading">
          <a href="#M000035" class="method-signature">
          <span class="method-name">with_options</span><span class="method-args">(options) {|ActiveSupport::OptionMerger.new(self, options)| ...}</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
An elegant way to factor duplication out of options passed to a series of
method calls. Each method called in the block, with the block variable as
the receiver, will have its options merged with the default
<tt>options</tt> hash provided. Each method called on the block variable
must take an options hash as its final argument.
</p>
<pre>
  with_options :order =&gt; 'created_at', :class_name =&gt; 'Comment' do |post|
    post.has_many :comments, :conditions =&gt; ['approved = ?', true], :dependent =&gt; :delete_all
    post.has_many :unapproved_comments, :conditions =&gt; ['approved = ?', false]
    post.has_many :all_comments
  end
</pre>
<p>
Can also be used with an explicit receiver:
</p>
<pre>
  map.with_options :controller =&gt; &quot;people&quot; do |people|
    people.connect &quot;/people&quot;,     :action =&gt; &quot;index&quot;
    people.connect &quot;/people/:id&quot;, :action =&gt; &quot;show&quot;
  end
</pre>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000035-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000035-source">
<pre>
    <span class="ruby-comment cmt"># File vendor/rails/activesupport/lib/active_support/core_ext/object/misc.rb, line 62</span>
62:   <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">with_options</span>(<span class="ruby-identifier">options</span>)
63:     <span class="ruby-keyword kw">yield</span> <span class="ruby-constant">ActiveSupport</span><span class="ruby-operator">::</span><span class="ruby-constant">OptionMerger</span>.<span class="ruby-identifier">new</span>(<span class="ruby-keyword kw">self</span>, <span class="ruby-identifier">options</span>)
64:   <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>